//
//  FLDownloadManager.h
//  Pods
//
//

#import <Foundation/Foundation.h>
#import "TCBlobDownloader.h"

NS_ASSUME_NONNULL_BEGIN

@interface FLDownloadManager : NSObject

+ (instancetype)sharedInstance;

/// 如果有下载对应url的文件路径, 无则返回nil
/// @param urlStr url字符串
- (NSString *)dataPathWithUrlString:(NSString *)urlStr;

/// 查询是否正在下载 返回 -1则没有在下载。
/// @param url 要查询的url
- (NSInteger)indexOfDownloadingWithUrl:(NSString *)url;

/// 下载之前 判断正在下载，暂停之前下载，开始新的下载。
- (TCBlobDownloader *)startSafeDownloadWithURL:(NSURL *)url
                                    customPath:(NSString *_Nullable)customPathOrNil
                                 firstResponse:(void (^)(NSURLResponse *response))firstResponseBlock
                                      progress:(void (^)(uint64_t receivedLength, uint64_t totalLength, NSInteger remainingTime, float progress))progressBlock
                                         error:(void (^)(NSError *error))errorBlock
                                      complete:(void (^)(BOOL downloadFinished, NSString *pathToFile))completeBlock;

@end

NS_ASSUME_NONNULL_END
